package com.example.kotlindemo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.kotlindemo.`interface`.Clickable2
import com.example.kotlindemo.ui.theme.KotlinDemoTheme

open class MainActivity : ComponentActivity(),Clickable2 {
    val str1 = "abc"
    val str2 = """value1
        value2\n\t
        value3
    """.trimMargin() //Raw String


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            KotlinDemoTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    ThreadUtils.onMainthread{
                        //todo
                    }
                    My.Companion.DEFAULT
                }
            }
        }
    }


//    fun getValue(a:Int):Int{
//        return 9
//    }

    //when function
    fun getValue(a: Int) = when {
        a > 0 -> "A"
        a < 0 -> "A1"
        a.hashCode() == 0x108 -> "222"
        else -> "KK"
    }

    //java 三目
    val status  = when {

        else -> {}
    }

    override fun click() {
        TODO("Not yet implemented")
    }
}

